Changed password function to support older PHP version