Fixing last run date query