Fixed cmd to be an empty ArrayList rather than null.