Fix minor bugs and tuning unpacking dict.