removed magic constants and fixet that bug