updated calculation bug for tofrom for OFF and removed debug output