Fixed multiple issues from the pull requests