Added a check for null columns, can cause problems with certain datatypes when empty otherwise