Adding $::is_virtual test and correcing elseif typo