Changed error loggin