More small fixes to logic