Fixed crash on ubuntu related to Buffer with zero length
Added jslint and tests