Added exception check