ReSharper fixes

ReSharper 8.x advisory potential code issues and bug fixes