#109: Applied fixes suggested by @komamitsu