Aren't you using a variable here that has potentially not been defined?