Bug fixes: #902, #903, #904, #906, #907, #908