Fix #6 and #7
Other fixes