Bug fix, improvements