Bug fixed using remove_empty.