Fixes parsing issues
merging some changes from Pull request. Also adds some compiler warning fixes.