remove unecessary matrix