small corrections, still not working but not memory leak anymore