fix #19: add safeguard for gridsize lower than kernel size