fix for reading RAW files

also added regression test for this