fixed bug in solve