Fixed Class Casts exceptions
Added test for instance delete