Fixed bug on error