fixed issues

fixed almost all issues.