Make resourceAvailable method more robust