After extensive testing I have found out that the problem is with the level on which the door is in relation to the surrounding. Each door needs to have at least 4 blocks in each direction on the same level as the door itself. 000000000000 001111XXXXXX 001111X1111X 001111X1BB1X 001111D1111X 001111X1111X 001111X1111X 001111X1111X 001111XXXXXX 000000000000 `0`,`1` - ground levels, `X` - wall, `B` - bed, `D` - door