check preconditions