Fix q require
Add simple error handling and fix Cookie header