Added function test
Changed the way value type is verified
Fixed builtin function logic