fix crash of dev server middleware