check type during assignment