Bug Fix for undefinded exceptions

Bug Fix for undefinded exceptions