add some fail safes