small changes + bug fix from upstream