added check incase foo is undefined