Added if condition for the bug