Fixed logic errors in init