added check to avoid error in firefox