more logs and error checks