bug in binary code

during testing it failed. issues with db code as well