updated to catch exception