Fixed issue #88, #89, #87.