now if-else works fine