Fix core functionality of deleteinstance