fixed problems with offset