correct dynamic types in optimized functions, added parser support to call dynamic functions