Fixed argument resolving

Fixes #572
This whole thing need a lot of love through refactoring