fixes; output optimizations