some bug fixes (for new production and analysis using grid)