major fix bugs