Added loggin check and error.