Update Main with bugfix from Sam.