fixed bug with MAX_ONES constant