add try except in some places