Added checks for nulls