added jw tests, fixed bug