fix typos and inefficient type conversion warnings