fix shared instance implementation
add isValid method
refactor from json to bson