setup callback on segment load