Fix #99/#53.

Thanks to @Mechazawa for the report and patch.