[PATCH] Fix a nasty bug happening in many places