Added type checking for assignments