add more coverage and fix bad exception