changed pattern to binary; fixed math error