32bit fixes

Should now compile and work on 32bit machines