Hopefully fixed BCD logic