Tested and fixed #2