Fixed some issues from the past pull request