fixed transformation bug, that could occassionally result in nan's