before updating offset logic