Fix bugs in cloning and installing from scratch