if-else issue fixed