Added type checking when processing expressions