Fixed a bug regarding the returned bytes read. Added more tests to very this for all types