Add startup directory feature and other bug fixes