fix x/y_from_buffer, add parens on global defines with division/multiplication