fix issues in #878

@devoncarew PTAL thanks.