added console protection