fix realFrom/To calculation