Bug fixes: #918, #937, #938, #939, #942, #943, #945, #946