compacts out nil weights