Updated the set function

It now properly checks wether virtuals exist at all, instead of assuming they do.