fixed missing if statement