fix bug with infinite loop on remove-with-padding