fix bugs in __init__