Implement #CSB-38
Fixed several misc bugs found while implementing