Fix bug in subs logic