add logging to catch errors