check availability logic