make this method more safe