Set better error logging