fixed bug in samjs