Hack to get middleware working