bugfix free memory