I had the same problem but found the solution here: https://codex.www.ads-software.com/Template_Tags/query_posts
There is no need to change any core files. Just insert this code right above your loop, and change the variables to suit your needs.
$categoryvariable=$cat; // assign the variable as current category
$query= 'cat=' . $categoryvariable. '&orderby=date&order=ASC'; // concatenate the query
query_posts($query); // run the query
works perfectly every time.