converted some throws to sensible errors