fixes for issues pointed out by majazaloznik