Fixed memory related issue