added control flow to error