bug fixes in isAvailable. Added SP to clear timed-out appointment locks