Fix bugs in generated instructions