Fix gravatarLookup method

Closes #4511
- Add missing "return" 
- Fix error handling

See #4511 for more details.