some improvements with errors