merged bug fix from etienne