fix the crash as suggested by @SpecLad