fix middleware to replace path_info properly if pop_prefix is used