ported bmap, but no tests