Developing bio functions
Fixed thread sleeping while waiting for timer

Also fixes allocbuf() buf size error