Small improvements and bug fix