Fixing .end() handlers.