added fix and global vars