fixed some invalid reads