Builtin func fixes

@lileicc 

This fixes the `min` and `max` builtin functions. I will also add `log` tomorrow, then this will be ready to merge.