Fixing bug with date search