Removed buffer as var name, it was being treated as reserved word.