Add debug messages, make move_head wait until all moving tasks finished