Fix for issue #5

When max_norm was close to 0, num_steps could become negative leading to bad results.