solved some bugs in 4,5 and logics