Fix redundant type errors and better line numbers