fix bugs with completing tasks