changed $parent to $context in second if

When using a variable for $context in the function parameters that contained units, it wasn't able to do the return because $context wasn't being redefined sans units.