Fix for a 'err is not defined' issue