fixed bugs in BMP22 code