Fixed bug in remove_empty.