Some fixes and better error response