add some error control