add fix from jsnums
a number of small fixes