fixes #297 -- Check bytes before decode