REALLY fixed set_function in virtual columns

Previous commit broke set_function in a different way. This commit
actually fixes behavior of set_function. See in-code comments for more
details.