fix #731, Fix #730, Fix #729

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