fixing middlewre function