adding some error exception handling