Added some debugging and fixed some handler leaks