fix log and improve exceptions (WIP)