various bug fixes and enhancements

Version V1 V2  
1 by Erick Calder View Revision