catch errors on init