fix smart decoding