fixed commands to apply on all matrices