switched to stdint.h; also added some error checking and stuff