fix bug in opt 1, should do a thorough instruction type checking