Fixed offset calculation

It should work fine now. At least on windows :x