fix #3861 + replace magic constant