fix BED_LIMIT_SWITCHING bug #267

one of the possible solutions.
maybe is not beautiful but it works