use check instead of exception handling