fixed some critical bugs
fixed bug