Fix #615, Fix #611, Fix #574

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