finally fixed 90% of the errors