repaired level switch

could be more elegant