Bugfix: freeing vm resources