added missing checks for declared functions