added more exceptions to check_matname function