adds missing end