Move type check after initialization to make compiler happy