Freezing bug fixed and memory usage probably reduced.