Raise error if type of variable changes