[Refactoring] Remove goto jumps
fix Issue 11888 - Incorrect behaviour taking slice from return value