bug fix and move thm upwards