Fixed some of the remaining functions that needed repair to work in windows and linux.