Small optimization and fix.