fixed bug due to factor representation