Fix a weird error of packageMap having undefined values