Critical current density, magnetization and AC losses in the YBa2Cu3O6.5+x superconductor