fixed crashing bug discovered while fixing issue 579