phpdoc for model + some bug fix