Spectroscopic monitoring of the BL Lac object AO 0235+164