Catching out of scope variable
Fixing return value