bug fixes due to sloppy scripting