fix for prototyped middleware functions