properly calculating offsets when binary is messed with