flatten arguments for VARP and VARPA, fix it's implementations and add tests