Messy but working error checker for number input