#1054 Fixed memory leak