Fix implicit conversion warnings

Fixed most warnings from -Wconversion, should fix issue  #190