Fixed a bug in computing day offset.