Resolving uncaught expection