Submitted pull #968 with fixes.