Can you show the code for the max/min? It's known to fail sometimes in scripts because of the old parser. It fails when using local instance variables in it. What you need to do is create a temporary variable and use that. Like:
var tx,ty; tx = x; ty = y;You can also use fmin/fmax in its place (if using only 2 operands) and that should be even faster for now (as the 2 operand case is still done using varargs in the current implementation and that means it even involves loops just for a simple thing like min(a,b) and max(a,b)).
some_min = min(tx,ty);