fixed end issues in tasks controller