added two overriden contructor and nullpointer check