Fix bug in formats.onChange

Fix bug in formats.onChange