fix warnings, minor optimizations in Reader