bug fix and lesson learned: there must be more offline tests