bugfix provided by @ninniuz