Update bed.cpp