fixed sequencing and type-related errors