Fixed bug checking nulls