more pre-conditions

free memory