fix typo.

Signed-off-by: Khral Steelforge <garuda2550@gmail.com>
Re-add typedefs and fix a bug.

Signed-off-by: Khral Steelforge <garuda2550@gmail.com>