fixes several issues