Fixed "function ends without a return statement" error
Import from my fork