Updated and locked PG gem version.
Improved automatic exception handling.