Fixed the bug where it shows 'undefined' as error