core: fix nested try-catch blocks processing