Fix #1671, Fix #1670, Fix#1660 Various backend improvements.