added guard; prevent some unnecessary execution of code that will not be used anyway