Bug fixes for #2378 and #2377 and documentation improvements