fixing the unnecessary packages addition into exception function