add some error logging