Fix label parsing and improve emulator