added more potential error fixes