fixed missing end statement