Fixed some type errors to throw normal errors