catch exception correctly
style fixes