god, only half implemented locking