Fix #23 and #35