added bdecode tests and some bug fixes