add error handling for non initialized array