Added ckecks and fixed error with missing export.