fixed bugs in bmap