Fixed bug with old-style classes
Added test case