solved several bugs