Convert buffer to string before passing to long constructor