Fixed some issues mentiond by Scrutinizer