first half of fix for issue 5