Improved p() error logging checks if  is an object before calling get_class