Fix tests including handling errors