Improvement and bug fix