fixed some bug; will add RESTful soon