You replaced the expression by b instead of substituting b into the expression for x.