Fixed logic functions error propagation, added few test cases