Fix error insertion in DB