fixed dup function bug