fixed bugs in remove_group and move_group functions