Small bug fix on error