fixed some bugs and corrected vcpu_attach error handling