fix bug #117
fix bug #119
fix bug #122
fix bug #123