small script changes + debugging