FIX #48 move URL generation before output

handling potential onAfterWrite changes on the record