Fixes for bugs 356 and 380