Initial support for ide stubs generation and some fixes