improve string to math method
(should be harder to break now)