minor changes and small bugs fixed