added error log functionality