Fixed some cleaning bugs