Fixed bug with classes cleanup