add error handling for cube