Fixed a bug, need to rethink the whole code generation thingy