Some fixes for script