fixing error while printing exception