added ensure attr to preferences. fixed __init__, worked on cython