Some small fixes for vectorization