Added code to fix #1