Logical bugs removed