improved dealing with null Values