Avoid improper checking, fixes #1584

ref #1584 
I fixed a few points as below.
* Can't destroy generated model.
* Can't destroy sub application.
* The tests that are related to `#already_exists` does not work well.