try to handle errors a little better