added nil checks for PR