[WIP] Codegen errors

- [x] Remove duplication of interfaces
- [x] Fix fatal errors
didn't work on `php 5.3`