Fixed error where function adds extra dashes after re-entering field