better implementation of restore_object method

now it checks 'read_only' and 'source' attributes