Fixing js error in masked input