Fixed a bug where the BitsPerSample was ignored.