Further fix for bug #310 (also fixes #332)