Fix #156 and #101