fixed issue with undefined variable