BUG FIX: Fixed a memory leak