Fixed issues from static analysis