Fixed memory leaks and try-catch backend issues