Improvement in accuracy of the finite element method in analysis of stability of Euler–Bernoulli and Timoshenko beams