Some CLI fixes when --target option is set