Fixed issue 2. Improved fix to issue 1.