BUG FIX: fixed a memory leak
CHANGE: changed when the free memory error is shown