Fixing various little bugs from opt