Fix #16 and #24