Partial fix for bug #166