Checking if vm is not nil before set device