More work on layer API and a quick fix for CartoDb/Wax