fix a return function bug