Fix internal error in emitItems