Fixed available() function calculation