fix illegal state exception in mapper in some cases