extract interfaces and fix errors