Memory overflow workaround with custom modules