minor cleanup in memory management