Added some path checking and bug fixes to c library