Fixed code issues reported by ReSharper