Fix #47 and #49