fix for bug52
some more fixes for bug 52
some more fixes for bug 52