Fixed the main script.