add control for error