Bug fix #66 and #69

Working #66