Make sure the gradient function is never called with invalid functionId
Add selection meta-function, clean plus meta-function.