Fix #867, Fix #868

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