add support for blocktype metadata
fix error return values