Added check which doesn't allow to input the wrong expression.