Fix ordering of tasks