wrap matrix base in try-catch