fixed some bash pitfalls, got rid of depricated .sh