fixed returning an undeclared variable