Fixed bug
Added simple test