Fix #926, Fix #925, Fix #924

Signed-off-by: Ross Allan <rallanpcl@gmail.com>