fixed some magic constants in the original code