fixed a few issues reported by code analyzer