fixing some bugs, still have to deal with SQLCE issue with VS2013