fixed bug on errors