minor bug fix with memory freeing