public static function unserialize(Project $project, $buildTimestamp = null, $statusDir = null)
    {
        if ($statusDir == null) {
            $statusDir = Xinc::getInstance()->getStatusDir();
        }

        if ($buildTimestamp == null) {
            //$fileName = $statusDir . DIRECTORY_SEPARATOR . $project->getName()
            //          . DIRECTORY_SEPARATOR . 'build.ser';
            $fileName = Xinc_Build_History::getLastBuildFile($project);
        } else {
            //$subDirectory = self::generateStatusSubDir($project->getName(), $buildTimestamp);

            // throws Xinc_Build_Exception_NotFound
            $fileName = Xinc_Build_History::getBuildFile($project, $buildTimestamp);
        }

        //Xinc_Build_Repository::getBuild($project, $buildTimestamp);
        if (!file_exists($fileName)) {
            throw new Xinc_Build_Exception_NotFound($project,
                                                    $buildTimestamp);
        } else {
            $serializedString = file_get_contents($fileName);
            $unserialized = @unserialize($serializedString);
            if (!$unserialized instanceof Xinc_Build) {
                throw new Xinc_Build_Exception_Unserialization($project,
                                                               $buildTimestamp);
            } else {
                /*
                 * compatibility with old Xinc_Build w/o statistics object
                 */
                if ($unserialized->getStatistics() === null) {
                    $unserialized->_statistics = new Xinc_Build_Statistics();
                }
                if ($unserialized->getConfigDirective('timezone.reporting') == true) {
                    $unserialized->setConfigDirective('timezone', null);
                }
                if (!isset($unserialized->_internalProperties)) {
                    if (method_exists($unserialized, 'init')) {
                        $unserialized->init();
                    }
                }

                return $unserialized;
            }
        }
    }