fix check for function existence