auto cleanup and other fixes