Fixed possible non-nil return on error