Fixed Undefiend variable error