fixed issues with negative offsets