fixed everything, added test