Fixes for bugs unlucky duck reported.