solves #124. Sort tasks