fixed bug in reading message frame header, added tests