updated error loggin