Fixed a constructor looping error and a few miscasts.