fixed signedness of pin used in functions