bug fixes, removed duplicate code. see changelog