merged the fix from Pino's work