format log error better
implement better error catching