Fixes (theoretically) #418 and #413.