fixed errors when the lib was loaded in a browser with no canvas support

Signed-off-by: Grant Skinner <info@gskinner.com>