factored out kernel size check