fixed availability queries edge case