fixing check for null attribute