exception check added, defensive programming