Fix a few errors in bed.c that broke things