Improved the checking for undefined properties