fix NPE at collisions + simpify in scripting