Fixed wrong order of res.write and res.status().set()