Made code work when not writing vector.