fixed weird script iproblem that was freezing app