Fixed some compilation issues due to header file inclusion and proper function signature of  on differenent operating systems.