Improved check for generator as a param