added access-control and fixed support for overwritten prepare