Minor update to check for undefined object