fixed invalid reads