The first bug solved, but there's another strange bug and a memory leak.