Fixed EXC_BAD_ACCESS.
Fixed bugs