Fix solution file and solve some memory leak issues