corrected remove_task for command history integrity