Updated the set function

It now properly checks wether virtuals exist at all, instead of assuming they do.
Merge pull request #169 from johanneslumpe/patch-7

Updated the set function