…the genitive case drives me crazy!

- Он не был дома.
- Его не было дома.


Are both these constructions correct, or is the 2nd (impersonal+Gen) better? Could they have different meaning?

Thanks for help.