Handle completing tasks properly