exception handling added