added onaftersave so the callback is valid