Null checking

Added NULL value checking for both constructors