replace explicit 'throw calls with 'assert where applicable