better memory management
fix examples