Minor Error Check

Added an extra error check.