Changed exception var name to ex