added checking to null