fix the throws problem and tests