fixed problems, tested