modal returns correct value