SOme fixes and added support for javamail resource