replacing "avoidLastArgumentInvocationOverflowing" function with much better mechanism, added tests