fixes bugs listed at #nerdnu/nerdbugs/117