Add missing parameters to some commands, add Lock for threadsafe commands.