Fix Pear Bug #19176

- Add Test 19176
- Fixed Pear Bug #19176
Fix Pear Bug #19315

- Add Test 19315
- Fixed Pear Bug #19315
Dead Code Removal
Whitespace Fixes