The abundance of C18O and HDO in the envelope and hot core of the intermediate mass protostar NGC 7129 FIRS 2