Better handling of invalid responses