fixed bug with errorcode