Fixed a couple of issues with decoding bitmaps.