Only first condition is working