fixes type error and changes constructor argument order