fix exception type and tests