Fix #14 and #16

This commit fixes #14 and fixes #16