Allow buffer as input (Fix #1)