Possibly part of the problem might be that you are sending an integer to a library function that is expecting a byte, which cannot be over 255. I don't know if the function truncates the integer down to a byte or if it just starts using the most significant part of the integer since you specified MSBFIRST.