Better handling of null var in db