made reader a bit more robust