Fixed Memory leak and exit bug when clicking with mouse