errors handled. fix #2