resolving bugs and generate the code