Ensure that the pg library is loaded before attempting to use it