A few changes in tapply to respect Lionel's rules