Fix bug and check that functions exist.