this should be checked at the beginning.