fix types according to tables