First condition works fine but rest are ignored