fix issue with missing end() call