fixes to allow script to work