Probable fix for Issue#250 and added regression tests for it