Fixed bug with setting distance to null when no value is entered