add some error protection