Fix generator returning invalid value