access_layer copied from delphii