fixed bug about undefined return