nial: moved hex stuff to math
math.ndf: fixed call to base