some fixes highlighted by ReSharper